package com.sq.partner.manager.service.impl;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.sq.partner.manager.dao.IFacadeUserDao;
import com.sq.partner.manager.dao.IGatewayChannelInfoConfigDao;
import com.sq.partner.manager.mybatis.model.FacadeUser;
import com.sq.partner.manager.mybatis.model.GatewaySubChannel;
import com.sq.partner.manager.mybatis.model.GatewayUser;
import com.sq.partner.manager.service.IFacadeUserService;
import com.sq.partner.manager.util.Page;

@Service
public class FacadeUserServiceImpl implements IFacadeUserService {
	
	@Resource
	private IFacadeUserDao userdao;
	
	@Resource
	private IGatewayChannelInfoConfigDao gatewayChannelInfoConfigDao;
	
	@Override
	public Page queryPage(Page page, Integer pageIndex, FacadeUser user)
			throws Exception {
		return userdao.queryPage(page, pageIndex, user);
	}

	@Override
	public boolean addUser(FacadeUser user) throws Exception {
		return userdao.addUser(user);
	}

	@Override
	public FacadeUser queryUserCountByMap(Map<String, String> map)
			throws Exception {
		return userdao.queryUserCountByMap(map);
	}

	@Override
	public boolean saveUser(FacadeUser user) throws Exception {
		return userdao.saveUser(user);
	}

	@Override
	public FacadeUser queryUserById(Long userid) throws Exception {
		return userdao.queryUserById(userid);
	}

	@Override
	public boolean delUserById(Long userid) throws Exception {
		return userdao.delUserById(userid);
	}

	@Override
	public Page<GatewaySubChannel> queryChannelListByDeptForTree(
			GatewayUser user,Page<GatewaySubChannel> page) throws Exception {
		return gatewayChannelInfoConfigDao.queryChannelListByDeptForTree(user,page);
	}

	@Override
	public boolean updateUser(FacadeUser user) throws Exception {
		return userdao.updateUser(user);
	}

	@Override
	public boolean delUserByUserCodeAndUserType(String userCode, String userType)
			throws Exception {
		return userdao.delUserByUserCodeAndUserType(userCode, userType);
	}

	@Override
	public boolean delUserBySubChannelCodeAndUserType(String subChannelCode,String userType) throws Exception {
		return userdao.delUserBySubChannelCodeAndUserType(subChannelCode, userType);
	}

}
